﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace NodeBasedSkillEditor.Model.Node.RT
{
    public class Node_ScalarToVector2_RT : RT_Node
    {
        public RT_SingleValuePort In_X;

        public RT_SingleValuePort In_Y;

        public RT_SingleValuePort Out_Vector2;

        public Node_ScalarToVector2_RT(Node_ScalarToVector2 sourceData, RT_DAG parentDag) : base(sourceData, parentDag)
        {
            In_X = new RT_SingleValuePort(EPortIOType.Input, sourceData.X, this);

            In_Y = new RT_SingleValuePort(EPortIOType.Input, sourceData.Y, this);

            Out_Vector2 = new RT_SingleValuePort(EPortIOType.Output, sourceData.Vector2, this);
            Out_Vector2.OnGetValue = GetOutVector2;
        }

        public AValue GetOutVector2(DAG_Executor executor)
        {
            var x = In_X.GetValue(executor) as Value_Scalar;
            var y = In_Y.GetValue(executor) as Value_Scalar;
            Out_Vector2.SourceValue.SetVector2(new Vector2(x.Value, y.Value));
            return Out_Vector2.SourceValue;
        }
    }
}
